<script setup lang="ts">
import { ref, watch } from 'vue';

const totalCount=ref(10)
const msg=ref('震惊')

watch([totalCount,msg],(newValue,oldValue)=>{
  console.log('totalCount 或 msg 变化了', { newValue, oldValue })
})
</script>

<template>
<p>功德值:{{ totalCount }}</p>
<p>{{ msg }}</p>
<button @click="totalCount++">功德+1</button>
<button @click="msg+='!'">点击继续震惊</button>
</template>